#!/usr/bin/perl

###########################################
#Author :  DebugProject _Brebion
#Created : 24/03/07
#Modified : 28/03/07
#Script : Add the head of XMl file for the coloration
###########################################

#Check the command line
if(scalar(@ARGV) !=3){die "[way to use : <file> <fileVerification> <pathToScript>"}	

$file = $ARGV[0];
$fileVerification = $ARGV[1];
$pathToScript = $ARGV[2];


#Check that exec_file1 exists
if(!(-e $file)){die "[File <file> doesn't exist]"}

#Openinning handles
open(INPUT,"<$file") || die "[Can't open file <file>]";
open(OUTPUT,">$fileVerification")|| die "[Can't open file <fileVerification>]";

#Write the head of file XMl
print OUTPUT "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n
<?xml-stylesheet href=\"".$pathToScript."colorVerif.xsl\" type=\"text/xsl\"?>\n\n";

#Rewrite of the entire file
while($ligne=<INPUT>){
	print OUTPUT $ligne;
}

#Closing handles 		
close OUTPUT;
close INPUT;
